#ifndef A_STAR_H
#define A_STAR_H

#include <Clarity/Math/Vector2.h>
#include <vector>

using Clarity::Vector2;
using namespace std;

	class ANode
	{
	public:
		inline ANode(const Vector2 &s_Pos)
			: m_Pos(s_Pos), m_G(0.0f),m_F(0.0f),m_H(0.0f),
			m_State(0), m_Parent(NULL), m_Next(NULL)	{}

		//inline const Vector2& GetPos() const
		//{return m_Pos;}

		//float m_X, m_Y;	//Position
		Vector2 m_Pos;
		float m_G;	//Cost of the step
		float m_F;	//Total Cost to Target
		float m_H;	//Estimated Cost to Destination
		int m_State;	//Am i on the Open list
		ANode* m_Parent;	//Where i came from
		ANode* m_Next;	//Next node along the path
		vector<ANode*> m_NodeList;	//List of nodes I am connected to
	};

class AStar
{
public:

	
	AStar();

	/*!
		Creates a Node @ this location
		@param s_Pos The Postion the node is to be created at
	*/
	void CreateNode(const Vector2 &s_Pos);
	/*!
		Connects The two Nodes, make sure these two ANodes have been retrieved from m_Nodes use GetNode(Index)
		@param s_One The First Node
		@param s_Two The Second Node
	*/
	void ConnectNodes(ANode* s_One, ANode* s_Two);
	/*!
		Returns the Total nodes on the map
	*/
	int NodeCount() const;
	/*!
		Gets a Node
		@para s_Index The index of the node you want to find
	*/
	ANode* GetNode(int s_Index);
	/*!
		Returns a Node that is the start of the path to Target
		@param s_Start Where to find to from
		@param s_End Where to find path to
	*/
	ANode* GetPath(ANode* s_Start, ANode* s_End);

void clearnodes();

private:
	
	
private:
	vector<ANode*> m_Nodes;		//Vector of Nodes
	ANode* m_Start;
	ANode* m_End;

	int inter;
};


#endif
